package weapp

import (
	"github.com/medivhzhan/weapp/code"
	"github.com/sirupsen/logrus"
	token2 "gitee.com/xiaofengfeng123/srv-paper-tape/api/token"
	"io/ioutil"
)

func AppCode(path string)[]byte{
	coder := code.QRCoder{
		Path: path,
		Width: 200,
		/*IsHyaline: true,
		AutoColor: true,*/
	}
	res,err := coder.QRCode(token2.Token.Get())
	if err != nil{
		logrus.Errorf("gen app code error: %s\n",err.Error())
		return nil
	}
	defer res.Body.Close()
	response, _ := ioutil.ReadAll(res.Body)
	//photo := base64.StdEncoding.EncodeToString(response)
	return response
}